import axios from '~/plugins/axios';
import { basicConfig } from '~/assets/js/config'

/*********Facebook 广告系列**********/

/**
 * 查询Facebook账户余额和已花费
 *
 * @param commit
 * @param state
 * @param preload
 */
export const getEffective = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/home/effective', {
        params: preload || {}
    })
};
export const getGoogleEffective = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/home/google/account/info', {
        params: preload || {}
    })
};


/**
 * 查询Facebook广告系列接口
 *
 * @param commit
 * @param state
 * @param preload
 */
export const manageListAdSeries = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/manager/adseries/list', {
        params: preload || {}
    })
};

/**
 * 编辑Facebook广告系列
 *
 * @param commit
 * @param state
 * @param preload
 */
export const updateAdSeries = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/adseries/updateAdSeries.do', preload || {})
        .catch(function(error) {});
};

/**
 * 编辑Facebook广告系列状态
 *
 * @param commit
 * @param state
 * @param preload
 */
export const updateAdSeriesStatus = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/adseries/updateAdSeriesStatus.do', preload || {})
};

/**
 * 删除Facebook广告系列接口
 *
 * @param commit
 * @param state
 * @param preload
 */
export const deleteAdSeries = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/adseries/deleteAdSeries.do', preload || {})
        .catch(function(error) {});
};

/**
 * 导出Facebook广告系列接口
 *
 * @param commit
 * @param state
 * @param preload
 */
export const downloadAdSeries = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/manager/adseries/download', {
        params: preload || {}
    })
};

/*********Facebook 广告组**********/

/**
 * 查询Facebook广告组接口
 *
 * @param commit
 * @param state
 * @param preload
 */
export const manageListAdGroup = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/manager/adgroup/list', {
        params: preload || {}
    })
};

/**
 * 编辑Facebook广告组
 *
 * @param commit
 * @param state
 * @param preload
 */
export const updateAdGroup = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/adgroup/updateAdGroup.do', preload || {})
        .catch(function(error) {});
};

/**
 * 编辑Facebook广告组状态
 *
 * @param commit
 * @param state
 * @param preload
 */
export const updateAdGroupStatus = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/adgroup/updateAdGroupStatus.do', preload || {})
};

/**
 * 删除Facebook广告组
 *
 * @param commit
 * @param state
 * @param preload
 */
export const deleteAdGroup = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/adgroup/deleteAdGroup.do', preload || {})
        .catch(function(error) {});
};

/**
 * 导出Facebook广告组excel
 *
 * @param commit
 * @param state
 * @param preload
 */
export const downloadAdGroup = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/manager/adgroup/download', {
        params: preload || {}
    })
        .catch(function(error) {});
};

/*********Facebook 广告**********/

/**
 * 查询Facebook广告接口
 *
 * @param commit
 * @param state
 * @param preload
 */
export const manageListAd = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/manager/ad/list', {
        params: preload || {}
    })
};

/**
 * 编辑Facebook广告
 *
 * @param commit
 * @param state
 * @param preload
 */
export const updateAd = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/ad/updateAd.do', preload || {})
        .catch(function(error) {});
};

/**
 * 编辑Facebook广告状态
 *
 * @param commit
 * @param state
 * @param preload
 */
export const updateAdStatus = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/ad/updateAdStatus.do', preload || {})
};

/**
 * 删除Facebook广告
 *
 * @param commit
 * @param state
 * @param preload
 */
export const deleteAd = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/ad/deleteAd.do', preload || {})
        .catch(function(error) {});
};

/**
 * 导出Facebook广告excel文件
 *
 * @param commit
 * @param state
 * @param preload
 */
export const downloadAd = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/manager/ad/download', {
        params: preload || {}
    })
        .catch(function(error) {});
};


/*********Facebook ABTest**********/

/**
 * Facebook abtest页面查询可用广告系列接口  ----广告系列名称列表
 *
 * @param commit
 * @param state
 * @param preload
 */
export const adSeriesItemList = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/manager/adseries/item/list', {
        params: preload || {}
    })
};

/**
 * Facebook abtest模块中 查询某个系列的成效信息
 *
 * @param commit
 * @param state
 * @param preload
 */
export const getAbTestList = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/manager/adseries/abtest/list', {
        params: preload || {}
    })
};



/*********Google 广告系列**********/

/**
 * 查询Google广告系列接口
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleManageListAdSeries = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/manager/google/series/list', {
        params: preload || {}
    })
};

/**
 * 编辑Google广告系列名字
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleUpdateAdSeries = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/google/series/update/seriesName', preload || {})
        .catch(function(error) {});
};

/**
 * 编辑Google广告系列状态
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleUpdateAdSeriesStatus = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/google/series/update/status', preload || {})
};

/**
 * 删除Google广告系列接口
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleDeleteAdSeries = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/google/series/delete', preload || {})
        .catch(function(error) {});
};

/**
 * 导出Google广告系列接口
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleDownloadAdSeries = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/manager/google/adseries/download', {
        params: preload || {}
    })
};

/*********Google 广告组**********/

/**
 * 查询Google广告组接口
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleManageListAdGroup = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/manager/google/adGroup/list', {
        params: preload || {}
    })
};

/**
 * 编辑Google广告组内容
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleUpdateAdGroup = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/google/adGroup/update/content', preload || {})
        .catch(function(error) {});
};

/**
 * 编辑Google广告组状态
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleuUdateAdGroupStatus = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/google/adGroup/update/status', preload || {})
};

/**
 * 删除Google广告组
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleDeleteAdGroup = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/google/adGroup/delete', preload || {})
        .catch(function(error) {});
};

/**
 * 导出Google广告组excel
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleDownloadAdGroup = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/manager/google/adgroup/download', {
        params: preload || {}
    } )
};



/*********Google 广告**********/
/**
 * 查询Google广告接口
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleManageListAd = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/manager/google/ad/list', {
        params: preload || {}
    })
};

/**
 * 编辑Google广告
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleUpdateAd = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/google/ad/update', preload || {})
        .catch(function(error) {});
};

/**
 * 编辑Google广告状态
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleUpdateAdStatus = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/google/ad/updateStatus', preload || {})
};

/**
 * 删除Google广告
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleDeleteAd = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/google/ad/delete', preload || {})
        .catch(function(error) {});
};

/**
 * 导出Google广告excel文件
 *
 * @param commit
 * @param state
 * @param preload
 */

export const googleDownloadAd = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/manager/google/ad/download', {
        params: preload || {}
    } )
};


/*********Google ABTest**********/

/**
 * Google abtest页面查询可用广告系列接口  ----广告系列名称列表
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleAdSeriesItemList = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/manager/google/ad/item/list', {
        params: preload || {}
    })
};

/**
 * Google abtest模块中 查询某个系列的成效信息
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleGetAbTestList = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/manager/google/ad/abtest/list', {
        params: preload || {}
    })
};




/*********Google 关键词**********/

/**
 * 查询Google关键词接口
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleManageListKeyword = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/manager/google/keyword/list', {
        params: preload || {}
    })
};

/**
 * 编辑Google关键词
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleUpdateKeyword = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/google/keyword/updateKey', preload || {})
        .catch(function(error) {});
};

/**
 * 编辑Google关键词状态
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleUpdateKeywordStatus = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/google/keyword/updateStatus', preload || {})
};

/**
 * 删除Google关键词接口
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleDeleteKeyword = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/google/keyword/delete', preload || {})
        .catch(function(error) {});
};

/**
 * 查询Google关键词 --------编辑关键词
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleQueryKeyword = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/manager/google/keyword/getCompetition', {
        params: preload || {}
    })
};

/**
 * 导出Google关键词接口
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleDownloadKeyword = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/manager/google/keyword/download', {
        params: preload || {}
    } )
};




/*********Google 产品附加信息**********/

/**
 * 查询Google产品附加信息接口
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleManageListAddition = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/manager/google/adExtensions/getAllExtensions', {
        params: preload || {}
    })
};

/**
 * 编辑Google产品附加信息-----------电话
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleUpdateAdditionCall = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/google/adExtensions/updateCall', preload || {})
        .catch(function(error) {});
};

/**
 * 编辑Google产品附加信息-----------链接
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleUpdateAdditionLink = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/google/adExtensions/updateSiteLink', preload || {})
        .catch(function(error) {});
};

/**
 * 编辑Google产品附加信息-----------宣传
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleUpdateAdditionCallout = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/google/adExtensions/updateCallOut', preload || {})
        .catch(function(error) {});
};

/**
 * 编辑Google产品附加信息-----------获取所有国家编码
 *
 * @param commit
 * @param state
 * @param preload
 */
export const getCountryList = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/admanager/google/listCountryCode.do', preload || {})
        .catch(function(error) {});
};


/**
 * 删除Google产品附加信息接口
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleDeleteAddition = function({commit, state}, preload) {
    return axios.post(basicConfig.baseUrl + '/manager/google/adExtensions/deleteExtensions', preload || {})
        .catch(function(error) {});
};


/**
 * 导出Google产品附加信息接口
 *
 * @param commit
 * @param state
 * @param preload
 */
export const googleDownloadAddition = function({commit, state}, preload) {
    return axios.get(basicConfig.baseUrl + '/manager/google/adExtensions/download', {
        params: preload || {}
    })
};



